package com.hzz.dao.log;

import com.hzz.framework.dao.IBaseDao;
import com.hzz.framework.entity.IEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>组织架构_员工登录日志 数据库处理接口类。
 */
@Mapper
public interface ILogLoginDao extends IBaseDao {
    /**
     * 判断是否存在
     */
    @Override
    @Select("select IFNULL(count(0),0) as count from log_login where  id = #{id} ")
    int isDataExist(IEntity entity) throws Exception;

    /**
     * 根据主键 物理删除
     */
    @Override
    @Delete("delete from log_login where  id = #{id} ")
    int deleteByPrimaryKey(IEntity entity) throws Exception;

    /**
     * 根据过期天数 物理删除
     */
    @Delete("delete from log_login where IFNULL(datediff(DATE_FORMAT(now(),'%Y%m%d'),DATE_FORMAT(date_created,'%Y%m%d')),999)>#{expireDay} ")
    int deleteByExpireDay(@Param("expireDay") Integer expireDay) throws Exception;
}